// pages/chulitousu/chulitousu.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
      p1:1,
      p0:0,
      name:'',
      a1:'',
    messagelistid:'',
    messagelist:[],
    chuliren:{},
      list:{
          v1:'投诉类型',
          v2:'投诉状态',
          v3:'投诉来源',
          v4:'投诉人',
          v5:'联系方式',
          v6:'投诉内容',
      },
      list1:{
          v1:'处理人',
          v2:'处理结果',
      },
      range:[ 
        { id: 1, name: '未处理' },
        { id: 2, name: '已处理' },

        ],
  },
    change1(e){
        const that=this;
        const index = e.detail.value
        that.setData({
          a1: that.data.range[index].name,
        })
        console.log(that.data.range[index].name);
    },
    change2(ee){
        const that=this;
        const index1 = ee.detail.value
        console.log(index1);
        that.setData({
          name:that.data.chuliren[index1].name
        })
        console.log(that.data.name);
    },
    click(){
        const that=this
        wx.request({
          url: 'http://10.10.18.237:8080/complaint/updateType?complaintStatus='+that.data.a1+'&id='+that.data.messagelistid+'&name='+that.data.name+'&uId='+that.data.p1,
          success(res){
              wx.request({
                url: 'http://10.10.18.237:8080/user/updateId?pId='+that.data.p1+'&name='+that.data.name,

                success(res){
                    wx.navigateTo({
                        url: '/pages/tousuguanli/tousuguanli',
                      })
                }
              })
          }
        })
    },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
      console.log(options.messagelistid)
    //   console.log(options.messagelistid.list.name)
      const that=this
      that.setData({
          messagelistid:options.messagelistid,
      })
      wx.request({
        url: 'http://10.10.18.237:8080/complaint/selectPart?id='+that.data.messagelistid,
        success(res){
            console.log(res.data[0].list);
            that.setData({
                messagelist:res.data,
                chuliren:res.data[0].list
            })
            console.log(that.data.name);


        }
      })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})